package com.hui.mapper;

import com.hui.entity.Category;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @Description
 * @date 2023/2/10 19:45
 */
public class CategoryMapper implements RowMapper<Category> {

    @Override
    public Category rowToEntity(ResultSet rs) {
        Category category = null;
        try {
            int categoryId = rs.getInt("categoryId");
            String categoryName = rs.getString("categoryName");
            String status = rs.getString("status");
            category = new Category(categoryId, categoryName,status);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }

        return category;
    }
}
